<!-- 我的分享 -->
<template>
	<view class="_page _box" :style="{ height: height, width: width }">
		<view class="qr-code-box">
<!-- 			<view class="num">
				<text>邀请码</text><text style="margin-left: 34rpx;">{{ num }}</text>
			</view> -->
			<image :src="userInfo.qrCod" mode="aspectFill" class="qr-code"></image>
		</view>
<!-- 		<view class="share_friends" @tap="shareFun">
			分享好友
		</view> -->
		<button class="share-btn share_friends" open-type="share">立即分享</button>
		<view class="friends_list" @tap="jumpTo">
			好友列表
		</view>
	</view>
</template>

<script>
	import {getCode} from '@/api/index.js';
	import config from '@/config/index';
	export default {
		data() {
			return {
				num: "12341561656789",
				img: "../../static/images/timg.jpg",
				userInfo:{},//用户信息
				userId:null,
				height: '',
				width: '',
			}
		},
		onShow() {
			this.userInfo = uni.getStorageSync('userInfo');
			this.userId =  this.userInfo.userId;
			// this.getCode();
		},
		created() {
			this.sysheight = uni.getSystemInfoSync().windowHeight
			this.height = `${this.sysheight}px`
			let width = uni.getSystemInfoSync().windowWidth
			this.width = `${width}px`
		},
		onShareAppMessage(res) {
			let _that = this
			console.log(_that.userId)
		      return {
		        title: '微信小程序余渝分享',
		        path: 'pages/login?userId='+ _that.userId
		      }
		},
		methods: {
			getCode(){
				let _that = this
				getCode('pages/login',_that.userId,80).then(re =>{
					console.log(re)
				}).catch(re=>{
					console.log(re);
				});
			},
			jumpTo(e) {
				uni.navigateTo({
					url: "friends_list"
				});
			}
		}
	}
</script>

<style>
	._page button{
		background-color: rgba(0,0,0,0)!important;
	}
	._page {
	
		display: flex;
		flex-direction: column;
		width: 100%;
		height: 100%;
		align-items: center;
		background: url("") no-repeat;

		background-size: 100% 100%;
	}

	.qr-code-box {
		background-color: #FFFFFF;
		width: 340rpx;
		height: 340rpx;
		margin: 360rpx 86rpx 0 86rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		border-radius: 20rpx;
		justify-content: center;
	}

	.num {
		padding-top: 52rpx;
		padding-bottom: 60rpx;
		text-align: center;
		width: 100%;
		height: 156rpx;
		color: rgba(240, 6, 23, 1);
		font-size: 32rpx;
		font-family: PingFangSC-regular;
	}

	.qr-code {
		width: 296rpx;
		height: 296rpx;
	}

	.share_friends {
		margin-top: 58rpx;
		width: 580rpx;
		height: 80rpx;
		text-align: center;
		line-height: 40rpx;
		border-radius: 60rpx;
		border: 2rpx solid rgba(255, 255, 255, 1);
		color: rgba(255, 255, 255, 1);
		font-size: 28rpx;
		font-family: PingFangSC-regular;
		padding: 20rpx 0 20rpx 0;
	}

	.friends_list {
		margin-top: 32rpx;
		width: 580rpx;
		height: 80rpx;
		line-height: 40rpx;
		border-radius: 60rpx;
		background-color: rgba(230, 10, 10, 1);
		color: rgba(16, 16, 16, 1);
		text-align: center;
		font-family: Arial;
		color: rgba(255, 255, 255, 1);
		font-size: 28rpx;
		font-family: PingFangSC-regular;
		padding: 20rpx 0 20rpx 0;
		margin-bottom: 80rpx;
	}
</style>
